import request from '@/utils/request';

export function getClassifyAPI(type) {
    return request({
        url: `/classify/${type}`,
        method: 'GET',
    });
}

export function addClassifyAPI(type, name) {
    return request({
        url: '/classify',
        method: 'POST',
        data: { type, name },
    });
}

export function putClassifyAPI(cid, name) {
    return request({
        url: `/classify/${cid}`,
        method: 'PUT',
        data: { name },
    });
}

export function delClassifyAPI(cid) {
    return request({
        url: `/classify/${cid}`,
        method: 'DELETE',
    });
}

// export function getArchiveTypesAPI() {
//     return request({
//         url: '/type',
//         method: 'GET',
//     });
// }

export function classifyIconUploaderAPI(cid, file) {
    const formData = new FormData();
    formData.append('file', file);
    return request({
        url: `/x/v1/classify/icon/uploader/${cid}`,
        method: 'POST',
        data: formData,
    });
}
